home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gigarom 1
/
Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso
/
FILES
/
HYP
/
E-G
/
Externals.cpt
/
Externals
/
card_8200.txt
< prev
next >
Wrap
Text File
|
1989-02-26
|
4KB
|
103 lines
-- card: 8200 from stack: in
-- bmap block id: 0
-- flags: 0000
-- background id: 2795
-- name: Find
-- part 1 (button)
-- low flags: 00
-- high flags: 8003
-- rect: left=316 top=307 right=329 bottom=380
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Demo
----- HyperTalk script -----
on mouseUp
visual effect iris open
go to card id 9227
end mouseUp
-- part contents for background part 1
----- text -----
XFCN
-- part contents for background part 22
----- text -----
Find(containerName,[<]string[,startLine,startItem])
-- part contents for background part 13
----- text -----
Find - finds a string in a container returning line & item number
containerName can be a field or variable with lines of data where each line consists of items.
If the string is not immediately preceeded by "<", then there must be an exact item match.
A starting line and item may optionally be specified and the search will begin in the next item.
The function returns the line and item number of the match as an ordered pair.
0,0 indicates that no match was found.
The match does take into consideration upper and lower case
This routine is not public domain. If you use it in your own stacks, you must send in a $10 license fee to:
Boojum Computer Systems, Inc.
15004 Donna Drive
Silver Spring, Md 20904
Copyright 1987 Boojum Computer Systems, Inc. All Right Reserved
--Find Script for Find Demo
on mouseUp
global source, lastPos, match -- match is either empty (excact) or "<" (partial)
put empty into card field "searchF"
set the scroll of card field "names" to 0
set the hilite of button "hiliteRegion" to false
ask "Find what state or capitol?" with source --get the search string
if it is not empty then
put it into source
put find( card field "names", match & source ) into lastPos
if item 1 of lastPos=0 then -- item not found
put empty into card field "lineF"
put empty into card field "itemF"
put "Search string not found" into card field "searchF"
set the hilite of button "hiliteRegion" to false
else
put "Line"&&item 1 of lastPos into card field "lineF" -- item is found
put "Item"&&item 2 of lastPos into card field "itemF"
put "Search string found in:" into card field "searchF"
put (the textHeight of card field "names")*¬
(item 1 of lastPos - 1) into scrollAmount
set the scroll of card field "names" to scrollAmount --scroll to the correct line
set the hilite of button "hiliteRegion" to true --hilite the line with invisible button
end if
end if
end mouseUp
--Next Find Script
on mouseUp
global lastPos, source, match
put empty into card field "searchF"
put find( card field "names", match & source, item 1 of lastPos,¬
item 2 of lastPos ) into lastPos
if item 1 of lastPos=0 then
put empty into card field "lineF"
put empty into card field "itemF"
put "Search string not found" into card field "searchF"
set the hilite of button "hiliteRegion" to false
else
put "Line"&&item 1 of lastPos into card field "lineF"
put "Item"&&item 2 of lastPos into card field "itemF"
put "Search string found in:" into card field "searchF"
put (the textHeight of card field "names")*¬
(item 1 of lastPos - 1) into scrollAmount
set the scroll of card field "names" to scrollAmount
set the hilite of button "hiliteRegion" to true
end if
end mouseUp